/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

def ac_to_id = [:]
def protein_file = new File ("/home/moghadda/Downloads/protein_alt_name.csv")

protein_file.eachLine{
    def columns = it.replace("\"", "").split(",")
    ac_to_id.put(columns[1], columns[0])
}

def group_file = new File("/mnt/phoenix/amin/hugo-unix/Documents/projects/stefanDB/id_accessionNumber.csv")

def index = 0


group_file.eachLine { i ->  
    if (index != 0) {
        def columns = i.split(",")
        def ids = columns[1].replace("\"", "").split(",")
        ids.each{
            
            println columns[0] + "," + ac_to_id[it.replace("-R", "") ]
        }
        
    }    
    index = 1
}
